<template>
	<view>
		<!--pages/Mcoupondetail/Mcoupondetail.wxml-->

		<view class="leftshow">
			<view class="couponshow">
				<view class="leftbody">
					<view class="clearfix clearfix-height">
						<view class="promote-card-name">{{coupon['coupon_name']}}</view>
					</view>
					<view class="center promote-value">
						<text class="promote-value-sign">
							<text>￥</text>
							<text>{{coupon['reduce_money']}}</text>
						</text>
					</view>
					<view class="center font-size-14 promote-limit">满{{coupon['need_money']}}元使用</view>
					<view class="center font-size-14 transparent-color">{{coupon['time']}}</view>
					<view class="dot"></view>
				</view>
				<view class="promote-desc">
					<view class="font-size-14 c-gray-dark promote-desc-title">使用说明</view>
					<view class="block border-top-0">
						<view class="block-item clearfix block-item-border">
							<view class="js-desc-detail">
								<block v-for="(item, index) in arr" :key="index">
									<view class="msgitem">{{item}}</view>
								</block>
							</view>
						</view>
					</view>
				</view>
				<view class="promote-desc">
					<view class="font-size-14 c-gray-dark promote-desc-title">可用门店</view>
					<view class="block border-top-0">
						<view class="block-item clearfix block-item-style">
							<view class="js-desc-detail">
								<block v-for="(item, index) in coupon['store_list']" :key="index">
									<view class="vipgrade">
										<text>{{item.store_name}}</text>
									</view>
								</block>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	// pages/Mcoupondetail/Mcoupondetail.js
	var app = getApp().globalData; // var WxParse = require('../../wxParse/wxParse.js');

	export default {
		data() {
			return {
				coupon: {},
				desc: "",
				arr: []
			};
		},

		components: {},
		props: {},

		/**
		 * 生命周期函数--监听页面加载
		 */
		onLoad: function(options) {
			var that = this;
			var id = options.id; //优惠券

			getApp().globalData.sendRequest({
				url: '/Vip/getCouponDetail',
				type: "post",
				data: {
					coupon_id: id
				},
				success: function(res) {
					// console.log(res);
					if (res.status == 1) {

						that.setData({
							coupon: res.coupon
						});
						var str = res.coupon.detail;
						var arr = str.split("<br/>");
						that.setData({
							arr: arr
						});
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						});
						setTimeout(function() {
							uni.navigateBack({
								delta: 1
							});
						}, 1500);
					}
				}
			});
		},

		/**
		 * 生命周期函数--监听页面初次渲染完成
		 */
		onReady: function() {},

		/**
		 * 生命周期函数--监听页面显示
		 */
		onShow: function() {},
		methods: {}
	};
</script>
<style>
	@import "./Mcoupondetail.css";
</style>
